package com.itheima.api.map.demo04;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class MapDemo04 {

    public static void main(String[] args) {

        Map<String, String> map = new HashMap<String, String>();

        map.put("蓝湛","魏婴");
        map.put("蓝忘机","魏无羡");
        map.put("含光君","夷陵老祖");

        Set<String> keySet = map.keySet();
        for(String key : keySet){
            String value = map.get(key);
            System.out.println(key + "=" + value);
        }
        System.out.println("-----------------------");


        Set<Map.Entry<String, String>> entrySet = map.entrySet();
        for(Map.Entry<String, String> entry : entrySet){
            String key = entry.getKey();
            String value = entry.getValue();
            System.out.println(key + "=" + value);
        }
        System.out.println("------------------------------------");

//        Set<Map.Entry<String, String>> entrySet = map.entrySet();
        for(Map.Entry<String, String> entry : map.entrySet()){
            String key = entry.getKey();
            String value = entry.getValue();
            System.out.println(key + "=" + value);
        }
    }
}
